<html>

<head>
    
  <script type="text/javascript" src="../../../../../../Scripts/jquery.js">
  </script>
    
  <script type="text/javascript" src="../../../../../../Scripts/SyntaxHighlighter/scripts/shCore.js">
  </script>
    
  <script type="text/javascript" src="../../../../../../Scripts/SyntaxHighlighter/scripts/shBrushDelphi.js">
  </script>
    
  <script type="text/javascript" src="../../../../../../Scripts/SyntaxHighlighter/scripts/shBrushCpp.js">
  </script>
    
  <script type="text/javascript" src="../../../../../../Scripts/SyntaxHighlighter/scripts/shBrushCSharp.js">
  </script>
    
  <link type="text/css" rel="stylesheet" href="../../../../../../Scripts/SyntaxHighlighter/styles/shCoreDefault.css">
    
  <link type="text/css" rel="stylesheet" href="../../../../../../Scripts/SyntaxHighlighter/styles/shThemeDefault.css">
  

  <title>Execute</title>

  <link rel="stylesheet" href="../../../../../../Styles/default.css" type="text/css">

    
  <script type="text/javascript" src="../../../../../../Scripts/bootstrap.js">
  </script>
  
</head>

<body bgcolor="#FFFFFF">
    
  <!-- THIS FILE HAS BEEN AUTOMATICALLY PROCESSED FROM A SOURCE COPY -->
    
  <!-- DO NOT EDIT MANUALLY !!! -->
  
  <table class="Banner" cellspacing="0" cellpadding="0" border="1" bordercolorlight="#303080" bordercolordark="#7070B0">
    <tr>
      <td class="Banner" nowrap=""><a href="../../../../../_Body.htm" class="Banner"><img src="../../../../../../Images/_Home.gif" align="absmiddle">Home</a>
      </td>
      <td class="Banner" nowrap=""><a href="../../../_Body.htm" class="Banner"><img src="../../../../../../Images/_Unit.gif" align="absmiddle">ClipperLib</a>
      </td>
      <td class="Banner" nowrap=""><a href="../_Body.htm" class="Banner"><img src="../../../../../../Images/_Class.gif" align="absmiddle">Clipper</a>
      </td>
      <td class="Banner" width="100%" align="right"><img src="../../../../../../Images/_Project_Logo.gif" align="absmiddle">
      </td>
    </tr>
  </table>
  <h1>Clipper.Execute</h1>


  <p class="Decl"><span class="Comment">Del.&raquo;</span><br> <b>function</b> Execute(clipType: <a href="../../../Types/ClipType.htm">TClipType</a>;<br> &nbsp;&nbsp;<b>out</b> solution: <a href="../../../Types/Paths.htm">TPaths</a>;<br> &nbsp;&nbsp;subjFillType: <a href="../../../Types/PolyFillType.htm">TPolyFillType</a> = pftEvenOdd;<br> &nbsp;&nbsp;clipFillType: <a href="../../../Types/PolyFillType.htm">TPolyFillType</a> = pftEvenOdd): boolean; <b>overload</b>;<br><br> <b>function</b> Execute(clipType: <a href="../../../Types/ClipType.htm">TClipType</a>;<br> &nbsp;&nbsp;<b>out</b> solution: <a href="../../PolyTree/_Body.htm">TPolyTree</a>;<br> &nbsp;&nbsp;subjFillType: <a href="../../../Types/PolyFillType.htm">TPolyFillType</a> = pftEvenOdd;<br> &nbsp;&nbsp;clipFillType: <a href="../../../Types/PolyFillType.htm">TPolyFillType</a> = pftEvenOdd): boolean; <b>overload</b>; </p>


  <p class="Decl2"><span class="Comment">C++&nbsp;&raquo;</span><br> <b>bool</b> Execute(<a href="../../../Types/ClipType.htm">ClipType</a> clipType,<br> &nbsp;&nbsp;<a href="../../../Types/Paths.htm">Paths</a> &amp;solution,<br> &nbsp;&nbsp;<a href="../../../Types/PolyFillType.htm">PolyFillType</a> subjFillType = pftEvenOdd,<br> &nbsp;&nbsp;<a href="../../../Types/PolyFillType.htm">PolyFillType</a> clipFillType = pftEvenOdd);<br><br> <b>bool</b> Execute(<a href="../../../Types/ClipType.htm">ClipType</a> clipType,<br> &nbsp;&nbsp;<a href="../../PolyTree/_Body.htm">PolyTree</a> &amp;solution,<br> &nbsp;&nbsp;<a href="../../../Types/PolyFillType.htm">PolyFillType</a> subjFillType = pftEvenOdd,<br> &nbsp;&nbsp;<a href="../../../Types/PolyFillType.htm">PolyFillType</a> clipFillType = pftEvenOdd); </p>

  <p class="Decl3"><span class="Comment">C#&nbsp;&nbsp;&raquo;</span><br> <b>public bool</b> Execute(<a href="../../../Types/ClipType.htm">ClipType</a> clipType,<br> &nbsp;&nbsp;<a href="../../../Types/Paths.htm">Paths</a> solution,<br> &nbsp;&nbsp;<a href="../../../Types/PolyFillType.htm">PolyFillType</a> subjFillType,<br> &nbsp;&nbsp;<a href="../../../Types/PolyFillType.htm">PolyFillType</a> clipFillType);<br><br> <b>public bool</b> Execute(<a href="../../../Types/ClipType.htm">ClipType</a> clipType,<br> &nbsp;&nbsp;<a href="../../PolyTree/_Body.htm">PolyTree</a> solution,<br> &nbsp;&nbsp;<a href="../../../Types/PolyFillType.htm">PolyFillType</a> subjFillType,<br> &nbsp;&nbsp;<a href="../../../Types/PolyFillType.htm">PolyFillType</a> clipFillType); </p>

<br>

  <p class="Body"> Once <em>subject</em> and <em>clip</em> paths have been assigned (via <a href="../../ClipperBase/Methods/AddPath.htm">AddPath</a> and/or <a href="../../ClipperBase/Methods/AddPaths.htm">AddPaths</a>), <b>Execute</b> can then perform the clipping operation (intersection, union, difference or XOR) specified by the <a href="../../../Types/ClipType.htm">clipType</a> parameter.<br><br> The <b>solution</b> parameter can be either a <a href="../../../Types/Paths.htm">Paths</a> or <a href="../../PolyTree/_Body.htm">PolyTree</a> structure. <span class="maroon">The Paths structure is simpler than the PolyTree stucture.</span> Because of this it is quicker to populate and hence clipping performance is a little better (it's roughly 10% faster). However, the PolyTree data structure provides more information about the returned paths which may be important to users. Firstly, <span class="maroon">the PolyTree structure preserves nested parent-child polygon relationships</span> (ie outer polygons owning/containing <em>holes</em> and holes owning/containing other outer polygons etc). Also, <span class="maroon"><b>only the PolyTree structure can differentiate between open and closed paths</b></span> since each PolyNode has an <a href="../../PolyNode/Properties/IsOpen.htm"><b>IsOpen</b></a> property. (The <a href="../../../Types/Path.htm"><b>Path</b></a> structure has no member indicating whether it's open or closed.) For this reason, <span class="maroon"><b>when <em>open</em> paths are passed to a Clipper object, the user must use a PolyTree object as the solution parameter</b></span>, otherwise an exception will be raised.<br><br> When a PolyTree object is used in a clipping operation on <b>open</b> paths, two ancilliary functions have been provided to quickly separate out <em>open</em> and <em>closed</em> paths from the solution - <a href="../../../Functions/OpenPathsFromPolyTree.htm"><b>OpenPathsFromPolyTree</b></a> and <a href="../../../Functions/ClosedPathsFromPolyTree.htm"><b>ClosedPathsFromPolyTree</b></a>. <a href="../../../Functions/PolyTreeToPaths.htm"><b>PolyTreeToPaths</b></a> is also available to convert path data to a Paths structure (irrespective of whether they're <em>open</em> or <em>closed</em>).<br><br> <img src="../../../../../../Images/common_edges.png" alt="" border="0" align="right"> There are several things to note about the solution paths returned: 
    <ul>
	
      <li>they aren't in any specific order</li>
	
      <li>they should never overlap or be self-intersecting (but see notes on <a href="../../../../../Overview/Rounding.htm"><b>rounding</b></a>)</li>
	
      <li>holes will be oriented opposite outer polygons</li>
	
      <li>the <strong>solution fill type</strong> can be considered either <em>EvenOdd</em> or <em>NonZero</em> since it will comply with either filling rule</li>
  
      <li>polygons may rarely share a common edge (though this is now <em>very rare</em> as of version 6)</li>

    </ul> </p><br>


  <p class="Body"> The <b>subjFillType</b> and <b>clipFillType</b> parameters define the polygon <a href="../../../Types/PolyFillType.htm"><b>fill rule</b></a> to be applied to the polygons (ie closed paths) in the subject and clip paths respectively. (It's usual though obviously not essential that both sets of polygons use the same fill rule.)<br><br> <b>Execute</b> can be called multiple times without reassigning subject and clip polygons (ie when different clipping operations are required on the same polygon sets).<br><br>  </p>


  <h2 id="Auto-SeeAlso">See Also</h2>
  <p class="Body"><a href="../../../../../Overview/Example.htm">Example</a>, <a href="../../../../../Overview/Rounding.htm">Rounding</a>, <a href="../../ClipperBase/Methods/AddPath.htm">ClipperBase.AddPath</a>, <a href="../../ClipperBase/Methods/AddPaths.htm">ClipperBase.AddPaths</a>, <a href="../../PolyNode/Properties/IsOpen.htm">PolyNode.IsOpen</a>, <a href="../../PolyTree/_Body.htm">PolyTree</a>, <a href="../../../Functions/ClosedPathsFromPolyTree.htm">ClosedPathsFromPolyTree</a>, <a href="../../../Functions/OpenPathsFromPolyTree.htm">OpenPathsFromPolyTree</a>, <a href="../../../Functions/PolyTreeToPaths.htm">PolyTreeToPaths</a>, <a href="../../../Types/ClipType.htm">ClipType</a>, <a href="../../../Types/Path.htm">Path</a>, <a href="../../../Types/Paths.htm">Paths</a>, <a href="../../../Types/PolyFillType.htm">PolyFillType</a></p>
    
  <p class="Copyright" id="auto"> <br><br> Copyright &copy;2010-2014 Angus Johnson&nbsp; - &nbsp; Clipper 6.2.1 &nbsp; - &nbsp; Help file built on 1-November-2014 <br><br> </p>
  
</body>

</html>